$(document).ready(function(){ 
 
	var t_col = ['故宫','国家博物馆','鸟巢','水立方'];
	$('#col01').val(new Yd_list().init(t_col).getStringLines());

	$('#chart_button').click(function(){
		
		var t_col01 = yd_text_input_col('#col01');
		var t_city = $('#c_city').val();
		var t_zoom = $('#c_zoom').val() - 0;

		var map = new BMapGL.Map("map_div");
		// map.centerAndZoom(new BMapGL.Point(116.404, 39.915), t_zoom);
		// 创建地址解析器实例  
        var myGeo = new BMapGL.Geocoder();  
        // 将地址解析结果显示在地图上，并调整地图视野  
        myGeo.getPoint(t_city, function(point){  
            if (point) {  
                map.centerAndZoom(point, t_zoom);  
                map.addOverlay(new BMapGL.Marker(point));  
            }else{  
                alert("您选择地址没有解析到结果!");  
            }  
        }, t_city);


		map.enableScrollWheelZoom(true); 
		var scaleCtrl = new BMapGL.ScaleControl();  // 添加比例尺控件
		map.addControl(scaleCtrl);
		var zoomCtrl = new BMapGL.ZoomControl();  // 添加缩放控件
		map.addControl(zoomCtrl);
		var cityCtrl = new BMapGL.CityListControl();  // 添加城市列表控件
		map.addControl(cityCtrl);

		var myKeys = t_col01;
		var local = new BMapGL.LocalSearch(map, {
			renderOptions:{map: map, panel:"search_result"},
			pageCapacity:5
		});
		local.enableFirstResultSelection();
		local.searchInBounds(myKeys, map.getBounds());
		
	});/*click function*/
		
});
